package pcjavanet.mobilesell.service;

import java.util.List;

import pcjavanet.mobilesell.model.Area; 
import pcjavanet.mobilesell.model.PageBean;
import pcjavanet.mobilesell.model.AreaExample;
import pcjavanet.mobilesell.model.QryCondition;
import pcjavanet.mobilesell.model.QryTerm;
import pcjavanet.mobilesell.persistence.AreaMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


@Service
public class AreaService {


  @Autowired
  private  AreaMapper areaMapper;


  public int  insert( Area area ) throws Exception{
	return areaMapper.insert (area);
  }


  public Area  selectByPrimaryKey( Area  bean ) {
 	int dbid = bean.getDbid();
	Area area = areaMapper.selectByPrimaryKey( dbid );
	return area ;
  }


  public int  updateByPrimaryKeySelective( Area area ) throws Exception{
	return areaMapper.updateByPrimaryKeySelective( area );
  }


  public int  deleteByPrimaryKey( Area  bean ) throws Exception{
 	int dbid = bean.getDbid();
	return areaMapper.deleteByPrimaryKey( dbid );
  }


  public List<Area>  selectByExample( Area area ) throws Exception{
    AreaExample example = new AreaExample();
	return areaMapper.selectByExample( example );
  }

  public List<Area>  getOnePageBeans( QryCondition condition , PageBean pageBean ) throws Exception{
    AreaExample example = new AreaExample();
    ServiceUtil.dealCriteria( condition,  example.createCriteria() );
	List<Area> ls=areaMapper.getOnePageBeans( example , pageBean );
//begin
	if ( ls.size() > 0 ) {
	}
//end
	return ls;
  }

  public int getTotalRecords( QryCondition condition , PageBean pageBean ) throws Exception{
    AreaExample example = new AreaExample();
    ServiceUtil.dealCriteria( condition,  example.createCriteria() );
	return areaMapper.getTotalRecords( example , pageBean );
  }

  public int countByExample( Area area , PageBean pageBean ){
    AreaExample example = new AreaExample();
	return areaMapper.countByExample( example );
  }
  public List<Area> selectByExamplePage( Area area , PageBean pageBean ){
  AreaExample example = new AreaExample();
	return areaMapper.selectByExamplePage( example , pageBean );
  }

}
